import { requestClient } from '../request';

export * from './auth';
export * from './menu';
export * from './user';

export interface BriefTaskProps {
  create_time: string;
  deal_time: string;
  file_time: string;
  id: number;
  name: string;
  result: any;
  result_desc: string;
}

// #获取任务列表
export function BriefTaskList(): Promise<BriefTaskProps[]> {
  return requestClient.get('/api/brief/taskList');
}

// #查看任务详情
export function BriefDetail(params: { id: number }): Promise<BriefTaskProps> {
  return requestClient.get('/api/brief/detail', {
    params,
  });
}

// #上传文件
export function BriefUploadFile(params: FormData): Promise<{
  create_time: string;
  file: string;
  file_time: string;
  id: number;
}> {
  return requestClient.post('/api/brief/uploadFile', params);
}

// #创建任务
export function BriefAddTask(params: { fileUrl: string; name: string }) {
  return requestClient.post('/api/brief/addTask', params);
}

// #更新任务
export function BriefUpdateTask(params: {
  name: string;
  result: any;
  resultDesc?: string;
  taskId: number;
}) {
  return requestClient.post('/api/brief/updateTaskResult', params);
}

// #删除任务
export function BriefDeleteTask(params: { id: number }) {
  return requestClient.post(`/api/brief/deleteTask?id=${params.id}`);
}
